package com.bjpowernode.springboot.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
public class UserController {

    @RequestMapping(value = "/user/message")
    public @ResponseBody Object map(){
        Map<String ,Object> map = new HashMap<>();
        map.put("id",1001);
        map.put("name","lisi");
        return map;
    }

    @RequestMapping(value = "/user/detail")
    public String detail(Model model){
        Map<String ,Object> map = new HashMap<>();
        map.put("id",1001);
        map.put("name","lisi");
        model.addAttribute("user",map);
        return "userDetail";

    }
}
